const Router = require("koa-router");
const router = new Router({ prefix: "/goods" });
const { verifyToken, hasAdminPer } = require("../middleware/user.middleware");
const { validator } = require("../middleware/goods.middleware");
const {
  upload,
  create,
  update,
  remove,
  restore,
  destore,
  findAll,
} = require("../controller/goods");
// router.post("/upload", verifyToken, hasAdminPer,upload);
router.post("/upload", upload);
router.post("/add", validator, create);
router.post("/update/:id", update);
// router.post('/remove/:id',remove)  // 硬删除
router.post("/remove/on/:id", restore);
router.post("/remove/off/:id", destore);
router.get("/", findAll);
module.exports = router;
